package com.qd.common.panda.domain.entity.stroke.mystroke;

import com.cdqidi.util.page.BaseQuery;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;
import java.util.Optional;

/**
 * 用户行程
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@ToString
public class UserStrokeVO extends BaseQuery {
    /**
     * 行程ID
     */
    private String sid;
    /**
     * 停车场
     */
    private String parkId;
    /**
     * 停车场显示
     */
    private String parkIdDisplay;
    /**
     * 车牌
     */
    private String plateNumber;
    /**
     * 用户唯一标识
     */
    private String userId;
    /**
     * 过程状态:0生成订单未入场1预约主动取消2预约超时取消3已入场4已缴费未出场5已出场
     */
    private Integer processStatus;
    /**
     * 过程状态显示
     */
    private String processStatusDisplay;
    /**
     * 行程类型:0停车1充电
     */
    private Integer tripType;
    /**
     * 用户停车
     */
    private UserParkStrokeVO userParkStroke;
    /**
     * 用户充电
     */
    private List<UserChargeStrokeVO> userChargeStrokeList;

    @Override
    public void freeData() {
        this.sid = null;
        this.parkId = null;
        this.parkIdDisplay = null;
        this.plateNumber = null;
        this.userId = null;
        this.tripType = null;
        Optional.ofNullable(userParkStroke).ifPresent(UserParkStrokeVO::freeData);
        Optional.ofNullable(userChargeStrokeList).ifPresent(List::clear);
        super.freeData();
    }
}
